/**
* @file StaticStreamingSound.cpp
* @author Max Ocklind
* @version 2010-01-10
*
* An easy-to-use wrapper for an OpenAL static streaming Ogg Vorbis sound source with some extra sound
* properties:</br>
* * sound priprity</br>
* * distance culling type</br>
* * sound type</br>
* * sound effect filter with an associated timer
*
* <p><b>Note:</b> if the default constructor is used the <code>StaticStreamingSound</code> object
* must be reseted (provided with a sound source) before it can be used!</p>
**/


/* includes */

#include "StaticStreamingSound.h"


/* functions */

/* public */

/**
* Sets the basic sound properties of the static streaming sound source.
*
* @param position pointer to floating point-vector
* @param velocity pointer to floating point-vector
* @param loop indicates if the static streaming sound should loop or not
* @param pitch the pitch of the sound (0.0 - ...)
* @param gain the gain (volume contribution, 0.0 - 1.0) to the over all sound output
* @param rolloffFactor specifies how fast the streaming sound should fade with distance (0.0 - ...)
*/
void StaticStreamingSound::setProperties(ALfloat *position, ALfloat *velocity, ALboolean loop, ALfloat pitch, ALfloat gain, ALfloat rolloffFactor)
{
	// looping handled by StreamingSound rather than by OpenAL
	StreamingSound::setProperties(position, velocity, AL_FALSE, pitch, gain, rolloffFactor);

	// set static sound properties
	alSourcef(mSource, AL_ROLLOFF_FACTOR, 0.0f);
	errCheck->checkALError("StaticStreamingSound", "setProperties (static roll of factor)");

	alSourcei(mSource, AL_SOURCE_RELATIVE, AL_TRUE); 
	errCheck->checkALError("StaticStreamingSound", "setProperties (static sound)");
}

/**
* Resets the properties of the sound source and replaces the current sound source with the
* specified sound source to allow reusage of this <code>StaticSound</code>-object.
*
* @param source the new sound source to replace the current one
*/
void StaticStreamingSound::reset(SoundSource source)
{
	StreamingSound::reset(source);
	mSoundType = STATIC_STREAMING_SOUND;
}

